package sg.edu.nus.ouroboros.helper;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class MyHttpClient {
	

	public static String makeRequest(String url){
		
		/*BufferedReader br = null;
		StringBuffer sb = null;
		try {
			HttpURLConnection connection = (HttpURLConnection)new URL(url).openConnection();
			connection.getInputStream();
			br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
			String temp = null;
			sb = new StringBuffer();
			while ((temp = br.readLine()) != null) {
				sb.append(temp);
			}
			br.close();
		} catch(Exception e){
			Log.e("EXCEPTION", "MyHttpClient::makeRequest#"+e.getMessage());
		}
		finally {

			try {
				if (br != null) {
					br.close();
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();*/
		StringBuffer buf = new StringBuffer();
		try {
			BufferedReader br = new BufferedReader(new FileReader("data/data/sg.edu.nus.oroboros/lib/TimeTableStudentSem3_json.txt"));
			String temp = null;
			
			while((temp = br.readLine()) != null ){
				buf.append(temp);
			}
			br.close();
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

		
		return buf.toString();
	}
} 


